home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / LogNormal.h,v < prev    next >
Text File  |  1989-02-22  |  3KB  |  128 lines

  1. head     3.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    grunwald:3.2; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 3.2
  10. date     89.02.20.15.35.53;  author grunwald;  state Exp;
  11. branches ;
  12. next     3.1;
  13.  
  14. 3.1
  15. date     88.12.20.13.50.01;  author grunwald;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     88.09.18.16.42.10;  author grunwald;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @@
  27.  
  28.  
  29. 3.2
  30. log
  31. @Start using Gnu library heaps for schedulers
  32. @
  33. text
  34. @// This may look like C code, but it is really -*- C++ -*-
  35. /* 
  36. Copyright (C) 1988 Free Software Foundation
  37.     written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
  38.  
  39. This file is part of GNU CC.
  40.  
  41. GNU CC is distributed in the hope that it will be useful,
  42. but WITHOUT ANY WARRANTY.  No author or distributor
  43. accepts responsibility to anyone for the consequences of using it
  44. or for whether it serves any particular purpose or works at all,
  45. unless he says so in writing.  Refer to the GNU CC General Public
  46. License for full details.
  47.  
  48. Everyone is granted permission to copy, modify and redistribute
  49. GNU CC, but only under the conditions described in the
  50. GNU CC General Public License.   A copy of this license is
  51. supposed to have been given to you along with GNU CC so you
  52. can know your rights and responsibilities.  It should be in a
  53. file named COPYING.  Among other things, the copyright notice
  54. and this notice must be preserved on all copies.  
  55. */
  56. #ifndef _LogNormal_h
  57. #define _LogNormal_h 
  58.  
  59. #include "Normal.h"
  60.  
  61. class LogNormal: public Normal {
  62.     double logMean;
  63.     double logVariance;
  64.     void setState();
  65. public:
  66.     LogNormal(double mean, double variance, RNG *gen);
  67.     inline double mean();
  68.     inline double mean(double x);
  69.     inline double variance();
  70.     inline double variance(double x);
  71.     virtual double operator()();
  72. };
  73.  
  74. //#ifdef __OPTIMIZE__
  75.  
  76. inline void LogNormal::setState()
  77. {
  78.     double m2 = logMean * logMean;
  79.     pMean = log(m2 / sqrt(logVariance + m2) );
  80.     pVariance = log((sqrt(logVariance + m2)/m2 ));
  81. }
  82.  
  83. inline LogNormal::LogNormal(double mean, double variance, RNG *gen)
  84.     : (mean, variance, gen)
  85. {
  86.     logMean = mean;
  87.     logVariance = variance;
  88.     setState();
  89. }
  90.  
  91. inline double LogNormal::mean() {
  92.     return logMean;
  93. }
  94.  
  95. inline double LogNormal::mean(double x)
  96. {
  97.     double t=logMean; logMean = x; setState();
  98.     return logMean;
  99. }
  100.  
  101. inline double LogNormal::variance() {
  102.     return logVariance;
  103. }
  104. inline double LogNormal::variance(double x)
  105. {
  106.     double t=logVariance; logVariance = x; setState();
  107.     return logVariance;
  108. }
  109.  
  110. #endif
  111. @
  112.  
  113.  
  114. 3.1
  115. log
  116. @Steay version
  117. @
  118. text
  119. @@
  120.  
  121.  
  122. 1.1
  123. log
  124. @Initial revision
  125. @
  126. text
  127. @@
  128.